#include<iostream>
#include<cstdio>
using namespace std;
const int N=2e5+11;
int a[N];
int tmp[N];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int f=0;
	while(!f){
		int pre=-1;
		for(int i=1;i<=n;i++){
			if(!tmp[i] && a[i]!=pre){
				printf("%d ",i);
				pre=a[i];
				tmp[i]=1;
			}
			if(!tmp[i]) f=1;
		}
		f=!f;
		printf("\n");
	}
	return 0;
}
